package com.farmpost.server.controller;


import com.farmpost.server.pojo.RespBean;
import com.farmpost.server.pojo.StuCertification;
import com.farmpost.server.service.IStuCertificationService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 学生认证表 前端控制器
 * </p>
 *
 * @author king
 * @since 2022-04-03
 */
@RestController
@RequestMapping("/stu-certification")
public class StuCertificationController {

    @Autowired
    private IStuCertificationService iStuCertificationService;

    @ApiOperation(value = "学生认证信息插入")
    @PostMapping("/insertStu")
    public RespBean insertStu(@RequestBody StuCertification stuCertification) {
        return iStuCertificationService.insertStu(stuCertification.getStuId(), stuCertification.getUserId(), stuCertification.getStuProfession(), stuCertification.getStuSchool(), stuCertification.getStuGraduateTime());
    }

    @ApiOperation(value = "学生头像上传")
    @PostMapping("/uploadStuFace")
    public RespBean uploadStuFace(@RequestPart MultipartFile file) throws Exception {
        return iStuCertificationService.uploadStuFace(file);
    }

    @ApiOperation(value = "查询学生认证信息")
    @GetMapping("/getStuInfo")
    public StuCertification getStuInfo(@RequestParam Integer userId) {
        return iStuCertificationService.getStuInfo(userId);
    }
}
